<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTasksTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('tasks', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('data_version_id')->default(0);
            $table->text('name')->comment('任务名称');
            $table->boolean('type')->default(true)->comment('任务类型 1-审核任务 2-参与任务');
            $table->dateTime('start_date')->nullable()->comment('任务创建时间');
            $table->dateTime('end_date')->nullable()->comment('任务结束时间');
            $table->integer('c_user_id')->default(0)->comment('处理人id');
            $table->string('c_user_name', 25)->default('')->comment('处理人姓名');
            $table->integer('creator_id')->default(0)->comment('创建人id');
            $table->string('creator_name', 25)->default('')->comment('创建人姓名');
            $table->boolean('status')->default(true)->comment('状态 1-待处理 2-已处理 ');
            $table->string('param', 255)->default('')->comment('url参数');
            $table->string('url', 255)->default('')->comment('处理页面地址');
            $table->string('form_key', 255)->default('')->index('form_key_index')->comment('数据来源类型');
            $table->integer('form_id')->default(0)->comment('数据来源id');
            $table->integer('menu_id')->default(0)->comment('菜单id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('tasks');
    }
};
